package com.example.springinterceptor.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/5/7 15:50
 */
@RestController
@RequestMapping("/user")
public class UserController {
    /**
     * 不拦截
     *
     * @return
     */
    @RequestMapping("/login")
    public String login() {
        Object o = null;
        o.hashCode();
        return "登录~";
    }

    @RequestMapping("/res")
    public String res() {
        int a = 10/0;
        return "注册~";
    }
    @RequestMapping("/getnum")
    public Integer getNum(){
        return new Random().nextInt(10);
    }
    @RequestMapping("/getstr")
    public String getStr(){
        return "Fuck-";
    }
    /**
     * 拦截
     */
    @RequestMapping("/getuser")
    public String getuser() {
        return "调用getuser~";
    }
}
